class IndexController < ApplicationController
  caches_page :qa, :hot
  def index
    unless read_fragment({})
      @latest = Pg::Weekly.last
      @results = Pg::WeeklyResult.find_all_by_weekly_id @latest.id, :order => "score_rank", :limit => @latest.rank_from, :include => :weekly_result_work
    end
  end

  def hot
    @bangumi_types = BangumiType.all :include => :hot_bangumis, :order => "bangumi_types.'index' desc"
  end

  def mylist
    unless read_fragment({})
      @pg_weeklies = Weekly.all :order => "id desc"
      @works = Work.all :conditions => ["wid in (?)", @pg_weeklies.collect(&:wid)]
    end
  end
end
